{% extends "index.html" %}
{% load i18n %}
{% load smart_if %}
{% block content %}

{% if event %}
	<h1>{{ event.name }} - {{ event.dateEvent }}</h1>
	<p>
	  <pre>heure : {{ event.timeEvent }}</pre>
	  <pre>description : {{ event.description }}</pre>
	  <pre>roster : {{ event.roster }}</pre>
	  <pre>nombre de joueurs : {{ event.nombreJoueurs }}</pre>
	</p>
	<p>
	{{ user.get_profile.defaultPersonnage }} : 
	<a href="/events/available/{{ event.id }}"><span class="green">je serai disponible</span></a>
	<a href="/events/unavailable/{{ event.id }}"><span class="red">je ne serai pas disponible</span></a>
	</p>
	<p>
	Remplacant : 
	<a href="/events/substitute/{{ event.id }}/{{ user.get_profile.defaultPersonnage.id }}"><span class="green">je serais remplacant</span></a>
	<a href="/events/unsubstitute/{{ event.id }}/{{ user.get_profile.defaultPersonnage.id }}"><span class="red">je ne serais pas remplacant</span></a>
	</p>
	<table cellpadding="2" cellspacing="1" class="eventParticipants">
	<tr>
	{% for key, value in participants.items %}
		<th class="classe_{{ value.css }}">{{ key }} ({{ value.available.count }})</th>
	{% endfor %}
	</tr>
	<tr>
	  <td colspan="0" class="separation">Disponibles</td>
	</tr>
	<tr>
	{% for key, value in participants.items %}
		<td class="classe_{{ value.css }}">
		{% for perso in value.available %}
			{% if perso not in value.substitutes %}
				{{ perso }},
			{% endif %}
		{% endfor %}
		</td>
	{% endfor %}
	</tr>
	<tr>
	  <td colspan="10" class="separation">Remplacants</td>
	</tr>
	<tr>
	{% for key, value in participants.items %}
		<td class="classe_{{ value.css }}">
		{% for perso in value.substitutes %}
			{% if perso in value.available %}
				{{ perso }},
			{% endif %}
		{% endfor %}
		</td>
	{% endfor %}
	</tr>
	<tr>
	  <td colspan="10" class="separation">Indisponibles</td>
	</tr>
	<tr>
	{% for key, value in participants.items %}
		<td class="classe_{{ value.css }}" >
		{% for perso in value.unavailable %}
			{{ perso }},
		{% endfor %}
		</td>
	{% endfor %}
	</tr>
	<tr>
	  <td colspan="10" class="separation">Ne savent pas</td>
	</tr>
	<tr>
	{% for key, value in participants.items %}
		<td class="classe_{{ value.css }}">
		{% for perso in value.dunno %}
			{% if perso not in value.available and perso not in value.unavailable %}
				{{ perso }},
			{% endif %}
		{% endfor %}
		</td>
	{% endfor %}
	</tr>
	
	</table>
{% else %}
	<h1>L'event n'existe pas.</h1>
{% endif %}

{% endblock %}
